package flc.ast.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyAudioBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.basic.utils.MediaUtil;
import stark.common.basic.utils.TimeUtil;

public class AudioAdapter extends StkProviderMultiAdapter<MyAudioBean> {

    public AudioAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(122));
        addItemProvider(new AudioProvider());
    }

    private class AudioProvider extends BaseItemProvider<MyAudioBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_audio;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyAudioBean bean) {
            baseViewHolder.setText(R.id.tvAudioItemName, bean.getName());
            baseViewHolder.setText(R.id.tvAudioItemDate, bean.getDate());
            baseViewHolder.setText(R.id.tvAudioItemSize, bean.getSize());
            baseViewHolder.setImageResource(R.id.ivAudioItemImg,R.drawable.yinpin1);
            if (bean.isSelect()){
                baseViewHolder.setImageResource(R.id.ivAudioSelect,R.drawable.xuanzhong1);
            }else{
                baseViewHolder.setImageResource(R.id.ivAudioSelect,R.drawable.weixuanzhong1);
            }
        }
    }


}
